﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace homeIMSService
{
    [ServiceContract]
    public interface IhomeIMSService
    {
        [OperationContract]
        userInfo Login(string userName, string password);
        // TODO: Add your service operations here

        [OperationContract]
        assetList getUserAssets(int userID);

        [OperationContract]
        int register(userInfo userInformation);

        [OperationContract]
        bool CheckUserName(string userName);

        [OperationContract]
        assetTypeList getAssetTypes();

        [OperationContract]
        assetQualityList getQualityList();

    }

    //data contract used to store all assets per user
    [Serializable]
    [DataContract]
    [KnownType(typeof(assetInfo))]
    public class assetList
    {
        [DataMember]
        public List<assetInfo> userAssets;
    }

    //data contract used to store all asset types
    [Serializable]
    [DataContract]
    [KnownType(typeof(assetType))]
    public class assetTypeList
    {
        [DataMember]
        public List<assetType> assetTypes;
    }

    //data contract used to store all asset qualities
    [Serializable]
    [DataContract]
    [KnownType(typeof(assetQuality))]
    public class assetQualityList
    {
        [DataMember]
        public List<assetQuality> assetQualities;
    }

    //data contract used to store asset types
    [Serializable]
    [DataContract]
    public class assetType
    {
        [DataMember]
        public string type { get; set; }

        [DataMember]
        public int typeID { get; set; }
    }

    //data contract used to store asset types
    [Serializable]
    [DataContract]
    public class assetQuality
    {
        [DataMember]
        public string quality{get;set;}

        [DataMember]
        public int qualityID { get; set; }
    }

    //data contract used to store user information for client use
    [Serializable]
    [DataContract]
    public class userInfo
    {
        [DataMember]
        public int userID{get; set;}

        [DataMember]
        public string userName { get; set; }

        [DataMember]
        public string password { get; set; }

        [DataMember]
        public string address { get; set; }

        [DataMember]
        public string city { get; set; }

        [DataMember]
        public string state { get; set; }

        [DataMember]
        public string zip { get; set; }

        [DataMember]
        public string phoneNumber { get; set; }
    }

    //data contract used to store information for assets per user
    [DataContract]
    [KnownType(typeof(purchInfo))]
    [KnownType(typeof(warrantyInfo))]
    [KnownType(typeof(maintenanceInfo))]
    public class assetInfo
    {

        [DataMember]
        public int assetID { get; set; }

        [DataMember]
        public int userID { get; set; }

        [DataMember]
        public int typeID { get; set; }

        [DataMember]
        public string type { get; set; }

        [DataMember]
        public string name { get; set; }

        [DataMember]
        public string manufacturer { get; set; }

        [DataMember]
        public int qualityID { get; set; }

        [DataMember]
        public string quality { get; set; }

        [DataMember]
        public string IDNumber { get; set; }

        [DataMember]
        public string make { get; set; }

        [DataMember]
        public string model { get; set; }

        [DataMember]
        public string comments { get; set; }

        [DataMember]
        public int retailValue { get; set; }

        [DataMember]
        public int quantity { get; set; }

        [DataMember]
        public DateTime createDate { get; set; }

        [DataMember]
        public DateTime purchDate { get; set; }

        [DataMember]
        public DateTime lastUpdate { get; set; }

        //lists that have more than 2 members per class per asset
        [DataMember]
        public purchInfo purchInfo { get; set; }

        [DataMember]
        public List<warrantyInfo> warrantyList { get; set; }

        [DataMember]
        public List<maintenanceInfo> maintenanceList { get; set; }
    }



    //data contract used to store purchase info per asset
    [DataContract]
    public class purchInfo
    {
        [DataMember]
        public int purchID { get; set; }

        [DataMember]
        public DateTime date { get; set; }

        [DataMember]
        public int cost { get; set; }

        [DataMember]
        public string store { get; set; }

        [DataMember]
        public string comments { get; set; }

    }

    //data contract used to store all warranty info per asset
    [DataContract]
    public class warrantyInfo
    {
        [DataMember]
        public int warrantyID { get; set; }

        [DataMember]
        public DateTime startDate { get; set; }

        [DataMember]
        public DateTime endDate { get; set; }

        [DataMember]
        public string coverage { get; set; }

        [DataMember]
        public int phoneNum { get; set; }

        [DataMember]
        public string comments { get; set; }
    }

    //data contract used to store maintenance info per asset
    [DataContract]
    public class maintenanceInfo
    {
        [DataMember]
        public int maintID { get; set; }

        [DataMember]
        public DateTime date { get; set; }

        [DataMember]
        public string location { get; set; }

        [DataMember]
        public int price { get; set; }

        [DataMember]
        public string company { get; set; }

        [DataMember]
        public string comment { get; set; }

    }
    
  
}
